package com.houger.ddd.redpacket.facade.impl;

import com.houger.ddd.redpacket.client.UserClientService;
import com.houger.ddd.redpacket.facade.dto.RedPacketDto;
import com.houger.ddd.redpacket.facade.UserClientFacade;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

/**
 * @author Houger.
 * @date 2024年04月18日 16:15.
 */
@Service
public class UserClientFacadeImpl implements UserClientFacade {
    @Resource
    UserClientService userClientService;
    @Override
    public String deduction(final RedPacketDto redPacketDto) {
        final String deduction = userClientService.deduction(redPacketDto);
        if (!"ok".equals(deduction)) throw new RuntimeException(deduction);
        return deduction;
    }
}
